<?php
	require('Tourny/tourny_functions.php');
	dblogin();
		
	$rule_num = $_GET['rule'];
	$gameid = $_GET['gameid'];
		
	$query = 
	'select gameid, 
			rule1_type, rule2_type, rule3_type, 
			rule1_title, rule2_title, rule3_title,
			rule1_optext, rule2_optext, rule3_optext
	 from GAMES g
	 where g.gameid = '.$gameid;	 
	 if($result = mysql_query($query)){
		if($row = mysql_fetch_array($result)){
			if($rule_num == '1'){
				$type = $row['rule1_type'];
				$title = $row['rule1_title'];
				$body = $row['rule1_optext'];
			}else if($rule_num == '2'){
				$type = $row['rule2_type'];
				$title = $row['rule2_title'];
				$body = $row['rule2_optext'];
			} else if($rule_num == '3'){
				$type = $row['rule3_type'];
				$title = $row['rule3_title'];
				$body = $row['rule3_optext'];
			}else{
				$type = '';
				$title = '';
				$body = '';
			}
		}
	}		
?>
<div id="hov_rule" class="<?php echo $type; ?> ">
	<input type="text" value="<?php echo $title; ?>" />
	<textarea> <?php echo $body; ?></textarea>
</div>